<?php
/*
 * Object/Site.php
 * Classe de représentation de Site
 */

namespace RHX\Model\Object;

class Site{
    public $id;
    public $libelle;
    public $adresse;
    public $photo;
    public $phone;
    public $fax;
    public $mail;
    public $metro;
    public $siret;
    public $tva;
    public $crt;
    public $assurance;
    public $urssaf;
    public $medecine_travail;
    public $centre_visite;
    public $directeur_id;
    public $marche;
    public $rib;
    
    public $lundi_prevision_ca;
    public $mardi_prevision_ca;
    public $mercredi_prevision_ca;
    public $jeudi_prevision_ca;
    public $vendredi_prevision_ca;
    public $samedi_prevision_ca;
    public $dimanche_prevision_ca;
    
    
    

    /**
     * Constructeur
     *
     * @param array $data
     */
    public function __construct($data = array()) {
	$this->exchangeArray($data);
    }

    /**
     * Remplissage des données
     *
     * @param array $data
     */
    public function exchangeArray($data) {
	$this->id	 = isset($data['id']) ? $data['id'] : null;
	$this->libelle	 = isset($data['libelle']) ? $data['libelle'] : '';
	$this->adresse	 = isset($data['adresse']) ? $data['adresse'] : '';
        $this->photo	 = isset($data['photo']) ? $data['photo'] : '';
        $this->phone	 = isset($data['phone']) ? $data['phone'] : '';
        $this->fax	 = isset($data['fax']) ? $data['fax'] : '';
        $this->mail	 = isset($data['mail']) ? $data['mail'] : '';
        $this->metro	 = isset($data['metro']) ? $data['metro'] : '';
        $this->siret	 = isset($data['siret']) ? $data['siret'] : '';
        $this->tva	 = isset($data['tva']) ? $data['tva'] : '';
        $this->crt	 = isset($data['crt']) ? $data['crt'] : '';
        $this->assurance	 = isset($data['assurance']) ? $data['assurance'] : '';
        $this->urssaf	 = isset($data['urssaf']) ? $data['urssaf'] : '';
        $this->medecine_travail	 = isset($data['medecine_travail']) ? $data['medecine_travail'] : '';
        $this->centre_visite	 = isset($data['centre_visite']) ? $data['centre_visite'] : '';
        $this->directeur_id	 = isset($data['directeur_id']) ? $data['directeur_id'] : '';
        $this->marche	 = isset($data['marche']) ? $data['marche'] : '';
        $this->rib	 = isset($data['rib']) ? $data['rib'] : '';
        
        $dWk = array('lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche') ;
        foreach($dWk as $k => $v){
            $keyCA = $v. '_prevision_ca';             
            $keyMO = $v. '_main_oeuvre';        
            $keyNT = $v. '_nb_transaction';        
            
            $this->$keyCA =  isset($data[$keyCA]) ? $data[$keyCA] : ''; ;
            $this->$keyMO =  isset($data[$keyMO]) ? $data[$keyMO] : ''; ;
            $this->$keyNT =  isset($data[$keyNT]) ? $data[$keyNT] : ''; ;
        }
        
        
    }

    /**
     * Copie Tableau des Propriétés
     *
     * @return array
     */
    public function getArrayCopy() {
	return get_object_vars($this);
    }

}
?>
